#ifndef __HASH_CMD_H__
#define __HASH_CMD_H__

#ifdef __cplusplus
extern "C" {
#endif

#include "hash_map.h"
#include <string.h>

#define CMD_HASH 0xb433e5c6

typedef void (*cmd_handler)(void);

typedef struct cmd {
    char* cmd;
    uint32_t hash;
    cmd_handler handler;
} cmd_t;

typedef struct cmd_map {
    char* cmd;
    cmd_handler handler;
}cmd_map_t;

typedef struct cmd_hash_map {
    hash_map* cmd_hash;
    cmd_map_t* cmd_map;
}cmd_hash_map_t;

void test1();
void test2();

void cmd_hash_parsing(cmd_hash_map_t* cmd_hash_map, char* cmd);
cmd_hash_map_t* cmd_hash_map_create(uint32_t size, bool use_lock, cmd_map_t* cmd_map, uint32_t map_size);

#ifdef __cplusplus
} /*extern "C"*/
#endif

#endif  /* __HASH_CMD_H__ */
